
import { NavLink,Routes,Route,Navigate } from 'react-router-dom';

import './App.css';
import Home from './Home';
import Login from './Login';
import Tables from './Table';
import RolesList from './RolesList';
import GoodList from './GoodList';
function App() {

  return (
    <div className="App">

      <Routes>
        <Route path='/' element={<Login />}></Route>
        <Route path='/login' element={<Login />}></Route>
        {/**
         * 建立二级路由就是在主路由在写路由
         */}
        <Route path='/home' element={<Home />}>
          {
            /**
             * index重定向，当访问/home的时候，就会主动触发二级路由
             */
          }
        <Route index element={<Tables />}/>
        <Route path='/home/users' element={<Tables />}/>
        <Route path='/home/roles' element={<RolesList />}/>
        <Route path='/home/goods' element={<GoodList />}/>
        </Route>
        <Route path='*' element={<Navigate to='/login'/>}></Route>
      </Routes>
 
    </div>
  );
}

export default App;
